 fonction gmod (n, m) {
	retour ((n% m) + m)% m;
}

fonction kuwaiticalendar (ajuster) {
	var aujourd'hui = new Date ();
	si (ajuster) {
		adjustmili = 1000 * 60 * 60 * 24 * ajuster; 
		todaymili = today.getTime () + adjustmili;
		aujourd'hui = new Date (todaymili);
	}
	jour = today.getDate ();
	mois = today.getMonth ();
	an = today.getFullYear ();
	m = 1 mois;
	y = année;
	if (m <3) {
		y - = 1;
		m + = 12;
	}

	a = Math.floor (y/100.);
	b = 2 a + Math.floor (a / 4.);
	if (y <1,583) b = 0;
	if (y == 1582) {
		si (m> 10) b = -10;
		if (m == 10) {
			b = 0;
			if (jour> 4) b = -10;
		}
	}

	jd = Math.floor (365,25 * (y 4716)) + Math.floor (30,6001 * (m +1)) + jour + b-1524;

	b = 0;
	si (jd> 2299160) {
		a = Math.floor ((jd-1.867.216,25) / 36524,25);
		b = 1 + a-Math.floor (a / 4.);
	}
	bb = jd + b 1524;
	cc = Math.floor ((bb-122.1) / 365,25);
	dd = Math.floor (365,25 * cc);
	ee = Math.floor ((bb-jj) / 30,6001);
	j = (bb-dd)-Math.floor (30,6001 * ee);
	mois = ee-1;
	si (ee> 13) {
		cc + = 1;
		mois = ee-13;
	}
	an = cc-4716;


si (ajuster) {
		wd = gmod (jd +1- régler, 7) 1;
	} Else {
		wd = gmod (jd +1,7) +1;
	}

	iyear = 10631./30.;
	epochastro = 1948084;
	epochcivil = 1948085;

	Switch1 = 8.01/60.;
	
	z = jd-epochastro;
	cyc = Math.floor (z/10631.);
	z = z-10631 * cyc;
	j = Math.floor ((z-Switch1) / iyear);
	iy = 30 * cyc + j;
	z = z-Math.floor (j * iyear + Switch1);
	im = Math.floor ((z 28,5001) / 29.5);
	si (== im 13) im = 12;
	id = z-Math.floor (29,5001 * im-29);

	MYRES var = new Array (8);

	MYRES [0] = jour; / / jour calculé (CE)
	MYRES [1] = 1 mois; / / mois calculée (CE)
	MYRES [2] = année; / / an calculé (CE)
	MYRES [3] = jd-1; / / nombre de jour julien
	MYRES [4] = wd-1; / / nombre de jours de la semaine
	MYRES [5] = id; / / date islamique
	MYRES [6] = im-1; / / mois islamique
	MYRES [7] = iy; / / an islamique

	retourner MYRES;
}
fonction writeIslamicDate (ajustement) {
	wdNames var = new Array ("Ø § Ù" Ø £ ØØ ¯ "," Ø § Ù "Ø ¥ Ø« Ù † USU † "," Ø § Ù "Ø« Ù "Ø § Ø« Ø § Ø ¡" , "Ø § Ù" Ø £ Ø ± Ø ¨ Ø ¹ Ø § Ø ¡"," Ø § Ù "Ø ® Ù ... USO ³", "Ø § Ù" Ø ¬ Ù ... Ø ¹ Ø © "," Ø § Ù "Ø ³ Ø ¨ Ø ª ");
	iMonthNames var = new Array ("Ù ... ØØ ± Ù ...", "ØμÙ? Ø ±", "Ø ± Ø ¨ USO ¹ Ø § Ù" Ø £ uu "", "Ø ± Ø ¨ USO ¹ Ø § Ù" Ø «Ø § Ù † nous»,
  "Ø ¬ Ù ... Ø § Ø ¯ Ù ‰ Ø § Ù" Ø £ uu "Ù ‰", "Ø ¬ Ù ... Ø § Ø ¯ Ù ‰ Ø § Ù" Ø «Ø § Ù † USO ©", "Ø ± Ø ¬ Ø ¨ "," O'O ¹ Ø ¨ Ø § Ù † »,
  "Ø ± Ù ... Ø § Ø ¶ Ù †", "Ø'ÙØ § Ù" "," Ø Ù Ø § ° Ù "Ù, Ø ¹ Ø ¯ Ø ©", "Ø Ù Ø § ° Ù" ØØ ¬ Ø © ");
	var = iDate kuwaiticalendar (ajustement);
	var = outputIslamicDate wdNames [iDate [4]] + "Ooe" 
	+ IDate [5] + "" + iMonthNames [iDate [6]] + "" + iDate [7] + "Ù ‡ Ù €»;
	retourner outputIslamicDate;
}